<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>聊天室</title>

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="./css/i.css">
  </head>
  <body>
    <header>
      <div class="row">
        <div class="col-xs-3 header-left"><i class="glyphicon glyphicon-chevron-left"></i></div>
        <div class="col-xs-6 header-center">聊天室案例</div>
        <div class="col-xs-3 header-right"><span style="color: #555;font-size: 12px;" id="online_user_count">0人在线</span> <i class="glyphicon glyphicon-record" style="color: #49d337;font-size: 12px;"></i></div>
      </div>
    </header>
    <div class="message-list-box">

    </div>

    <div class="send-box">
      <div class="send-left">
        <textarea id="send-input" rows="1"></textarea>
      </div>
      <div class="send-right">
        <a href="javascript:send();">发送</a>
      </div>
    </div>

    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
    <!-- 这个函数库一点要先导入 -->
    <script src="./js/function.js"></script>
    <script>
      // 这里我只是临时准备了一组昵称和头像
      var photo_arr = ['http://qukufile2.qianqian.com/data2/pic/140d09665d1c204efe00973c3e16282c/579342600/579342600.jpg','http://qukufile2.qianqian.com/data2/pic/d06f59a51303f15f86a801b0e0c64f76/580384071/580384071.jpg@s_0,w_130','http://qukufile2.qianqian.com/data2/pic/26fd26d06eba326803126ac019fbe3c6/608321106/608321106.jpg@s_0,w_130','http://qukufile2.qianqian.com/data2/pic/246708025/246708025.jpg@s_0,w_130','http://qukufile2.qianqian.com/data2/pic/246709489/246709489.jpg@s_0,w_130'];
      var username_arr = ['薛之谦','任贤齐','张信哲','费玉清','阎维文','王力宏','张学友','徐良','古天乐','郑伊健','付笛声','林志炫','刀郎'];
      // 每次刷新的时候随机取一个昵称和头像
      var uid = randomNum(1,999999);
      var username = username_arr[randomNum(0,12)];
      var photo = photo_arr[randomNum(0,4)];
    </script>
    <!-- 这个chat.js文件就是websocket相关的代码，必须后引入 -->
    <script src="./js/chat.js"></script>
  </body>
</html>